package cn.com.cetccst.datacenter.policy.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Query;

import java.util.List;

import cn.com.cetccst.datacenter.collection.dao.BaseDao;
import cn.com.cetccst.datacenter.policy.entity.RestrictionEntity;

@Dao
public interface RestrictionDao extends BaseDao<RestrictionEntity> {
    @Query("select value from " + RestrictionEntity.TABLE_NAME + " where name=:restrictionName LIMIT 1")
    LiveData<Integer> getStatus(String restrictionName);

    @Query("select * from " + RestrictionEntity.TABLE_NAME + " where value=0")
    LiveData<List<RestrictionEntity>> queryAllDisabled();

    @Query("select * from " + RestrictionEntity.TABLE_NAME)
    LiveData<List<RestrictionEntity>> queryAll();

    @Query("DELETE FROM " + RestrictionEntity.TABLE_NAME)
    void clearAll();
}
